package com.mao.service.searchvoucher;

import java.io.OutputStream;
import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.mao.action.jsonvo.searchcenter.JsonVoSearchProfit;
import com.mao.action.jsonvo.searchcenter.JsonVoSearchPurchaseByProduct;
import com.mao.action.jsonvo.searchcenter.JsonVoSearchVoucherByProduct;
import com.mao.action.jsonvo.searchcenter.JsonVoVoucherProduct;
import com.mao.model.voucher.ProductVoucherBase;
import com.mao.model.voucher.VoucherBase;
import com.mao.model.voucher.VoucherType;
import com.mao.service.impl.searchvoucher.SearchStockCondition;
import com.mao.service.impl.searchvoucher.SearchVoucherCondition;

@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public interface ISearchVoucherService {
	public List<VoucherBase> searchVoucher(Long storeid, Integer page,
			Integer rows, SearchVoucherCondition searchVoucherCondition);

	public int searchVoucherCount(Long storeid, Integer page, Integer rows,
			SearchVoucherCondition searchVoucherCondition);

	public VoucherBase getVoucherById(String voucherType, Long id);

	public List<JsonVoVoucherProduct> searchProductsByVoucher(long voucherid, VoucherType voucherType);
	
	public List<JsonVoSearchVoucherByProduct> searchVoucherByProduct(SearchVoucherCondition searchVoucherCondition,Integer page, Integer rows);
	
	public Integer searchVoucherByProductCount(SearchVoucherCondition searchVoucherCondition);
	
	public List<JsonVoSearchVoucherByProduct> searchVoucherByOrg(SearchVoucherCondition searchVoucherCondition,Integer page, Integer rows);
	
	public Integer searchVoucherByOrgCount(SearchVoucherCondition searchVoucherCondition);
	
	public List<JsonVoSearchVoucherByProduct> searchVoucherByWH(SearchVoucherCondition searchVoucherCondition,Integer page, Integer rows);
	
	public Integer searchVoucherByWHCount(SearchVoucherCondition searchVoucherCondition);
	/**
	 * 根据商品ID获取单据和商品的中间表
	 * @param productid
	 * @return List<ProductVoucherBase>
	 */
	public List<ProductVoucherBase> getPvbByPro(long productid,VoucherType voucherType);
	
	/**
	 * 统计查询中查询统计
	 * @param pcId
	 * @param page
	 * @param rows
	 * @return
	 * @return List<JsonVoSearchPurchaseByProduct>
	 */
	public List<JsonVoSearchPurchaseByProduct> getSearchByProduct(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows);
	
	public Integer getSearchByProductCount(SearchVoucherCondition searchVoucherCondition);
	
	
	public List<JsonVoSearchPurchaseByProduct> getSearchPurchaseByOrg(SearchVoucherCondition searchVoucherCondition,Integer page, Integer rows);
	
	public Integer getSearchPurchaseByOrgCount(SearchVoucherCondition searchVoucherCondition);
	
	public List<JsonVoSearchPurchaseByProduct> getSearchPurchaseByWH(SearchVoucherCondition searchVoucherCondition,Integer page, Integer rows);
	
	public Integer getSearchPurchaseByWHCount(SearchVoucherCondition searchVoucherCondition);
	
	public List<JsonVoSearchProfit> searchProfit(SearchVoucherCondition searchVoucherCondition,Integer page, Integer rows);
	
	public Integer searchProfitCount(SearchVoucherCondition searchVoucherCondition);
	
	
	public void exportExcel(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);
	public void exportExcelOrgs(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);
	
	public void exportExcelWHs(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);
	
	public void exportWareHouseDetail(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);

	public void exportReturnWareHouseDetail(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);

	public void exportDeliveryDetail(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);

	public void exportReturnDeliveryDetail(SearchVoucherCondition searchVoucherCondition, Integer page, Integer rows, OutputStream os);
	
	public Integer getStockByProductId(Long proId,Long wareHouseId,String stime,String etime);
	
	public Integer getWareHouseNumByProId(SearchStockCondition searchStockConditon);
	
	public Integer getReturnWareHouseNumByProId(SearchStockCondition searchStockConditon);
	
	public Integer getDeliveryNumByPorId(SearchStockCondition searchStockConditon);

	public Integer getReturnDeliveryNumByProId(SearchStockCondition searchStockConditon);
	
	public Integer getWareHouseNumDWR(SearchStockCondition searchStockConditon);
	
	/**
	 * 获取实际的销售数量
	 */
	public Integer getDeliveryNumDWR(SearchStockCondition searchStockConditon);
	
}
